/*
 * Copyright (c) 2006, 2023, webrx.cn All rights reserved.
 *
 */

package cn.webrx;

/**
 * <p>Project: jse2303 - Str2
 * <p>Powered by webrx On 2023-07-17 11:45:12
 * <p>描述：<p>
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Str2 {
    public static void main(String[] args) {
        String s1 = "ok";
        String s2 = new String("hello\'java\"java17\"");
        System.out.println(s2);
        System.out.println("---------------------------");
        String s3 = "ok\b\nja\tv\sa\\";
        System.out.println(s3);

        String s11 = "hello";
        String s12 = "hello";
        System.out.println(s11 == s12);

        String s13 = new String("Hello");
        String s14 = new String("hello");
        //比较对象
        System.out.println(s13 == s14);

        //比较内容
        System.out.println(s13.equals(s14));

        //忽略大小写比较内容
        System.out.println(s13.equalsIgnoreCase(s14));

        String s4 = "中国china";

        //获取字符串元素个数
        System.out.println(s4.length()); //length()方法
        //获取字符串字节数
        System.out.println(s4.getBytes().length);//length属性
    }
}
